#!/bin/bash

#  3 4 6, 7 9 11 13 14 15 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 33 34 35

randacctime=1600
splitacctime=700
memoryblockGB=14 #total 16GB
#memoryblockGB=10
#memoryblockGB=15

# noop anticipatory deadline cfq
for alg in b c d  e f g; do 
#   echo noop > /sys/block/sd$alg/queue/scheduler 
#   echo anticipatory > /sys/block/sd$alg/queue/scheduler 
   echo deadline > /sys/block/sd$alg/queue/scheduler 
#   echo cfq > /sys/block/sd$alg/queue/scheduler 
    echo -n "sd$alg "
    cat /sys/block/sd$alg/queue/scheduler 
done 

j=10 # 10 Megabytes Blcok Size

echo "- Test For $j Megabytes Block -"
let "size = $j *1024 * 1024"
for ((i=1; i < 20; i++)); do
    echo -n "- JOB $i TEST START @@- , "

    ../disktest/randtest $i $randacctime $size $memoryblockGB &
    sleep 100 && ./splitacc.sh $i $splitacctime $j &

    wait

    if [ ! -d ./singlethread/${j}M ] ; then
        mkdir ./singlethread/${j}M
    fi

    mkdir ./singlethread/${j}M/$i
    mv t_*.dat ./singlethread/${j}M/$i/

    echo -e "- JOB $i TEST DONE $\$ -"
done

for i in 25 30 40; do
    echo -n "- JOB $i TEST START @@- , "

    ../disktest/randtest $i $randacctime $size $memoryblockGB &
    sleep 100 && ./splitacc.sh $i $splitacctime $j &

    wait

    if [ ! -d ./singlethread/${j}M ] ; then
        mkdir ./singlethread/${j}M
    fi
    mkdir ./singlethread/${j}M/$i
    mv t_*.dat ./singlethread/${j}M/$i/

    echo -e "- JOB $i TEST DONE $\$ -"
done
echo "- Test For $j Megabytes Block Done -"

